home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 4
/
Precision Software Applications Silver Collection Volume 4 (1993).iso
/
stats
/
mathx30.exe
/
TRIANGLE.UTL
< prev
Wrap
Text File
|
1991-06-09
|
9KB
|
245 lines
Z''=INFO:z'''=int((z''-int(z''/10000)*10000)/1000):if z'''=0}1
| TRIANGLE.UTL, Copyright 1991 by David Denker |
| Box 115, Isanti, Mn. 55040 |
DSP N" SORRY, THIS FILE CAN ONLY BE RUN ON MATH EXTRA!"N
WAIT10:QUIT
#1:Z'''=INT(Z''*.0001):IF Z'''=>300}2
DSP nn; Sorry, this file must be used with MATHX V3.00 or greater!;n
wait20:quit
#2:DEGM
TITLE= TRIANGLE PROGRAMS
#3:goff:CLS:WLCC L2f15b6
HEAD B0F14" Select by the PICK LETTER or use MOUSE or CURSOR keys."
menuu bb1bf16b11f0I;
;!O;blique triangle
;!Q;uit
;!R;ight triangle;x
#6
j=mlvl:on(j)g{510,7,500}:quit
#7:quit
#9:j''=data k{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,2,0,0,0,0,0,0,0,0}:ret
#32
HOFF:dsp n; "M"enu, "R"edo, else quit! ;:i'=kyin
if i'=77}3:if i'=109}3:if i'=82}6:if i'=114}6:quit
#40:head ; Enter 0 to quit. Hit the F1 key for HELP;:ret
#249:beep:wait4:go500
#248
wind wr10wc78r1c0bb1bf14b11f0" Right Triangle Program:
A
Pick the two knowns |\ A & B are angles in
and give their values. | \ degrees.
y | \ h At least one side must
The program will give you | \ be given.
the unknowns. | \
|__________\
90 x B
":RET
#250
CLS:GOS40:GOS248:I''=1
#251
a=0:b=0:h=0:x=0:y=0:$i="0":row12
dsp" Pick the first known: (A,B,x,y,h) ":$i=inp(1){400}:if $i="0"}q
call 266:if c'=0}251
c''=c':dsp n" What is its value? ":i'=inp{401}
if i'=0}q:if sgn i'=-1}264:call267
dsp n
#252
$i="0":dsp " Pick the second known: "
$i=inp(1){400}:if $i="0"}q:call 266:if c'=0}252
dsp n" What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}264
call267
c'=c''+c':if c'=24}260
if c'=2}261:if c'=4}261:if c'=8}261:if c'=16}261:if c'=32}261
if a=>90}263:if b=>90}263
if c'<13}253:c'=c'-8
#253
if h=0}254:if h<=x}262:if h<=y}262
#254
x=data c'{,,,x,,x,sqr(h^2-y^2),,,x,y*tan a,,h*sin a}
y=data c'{,,,y,,sqr(h^2-x^2),y,,,x*tan b,y,,sqr(h^2-x^2)}
if h<>0}255:h=sqr(x^2+y^2)
#255:if a<>0}256:a=atn(x/y):b=90-a
#256
dsp r12c0" A ="(a)s10n" B ="(b)s10n" x ="(x)s10n" y ="(y)s10n" h ="(h)s10n
GOTO32
#260:dsp n" ERROR: AT LEAST ONE SIDE MUST BE GIVEN!":goto249
#261:dsp n" ERROR: A KNOWN WAS USED TWICE!":goto249
#262:dsp n; ERROR: "h" must be greater than "x" or "y"!;:goto249
#263
dsp n" ERROR: AN ANGLE CANNOT BE EQUAL TO OR GREATER THAN 90°!":GOTO249
#264:dsp n" ERROR: A KNOWN CANNOT BE NEGATIVE!":goto249
#266:c'=1:if $i="x"}r:if $i="X"}r:c'=2:if $i="y"}r:if $i="Y"}r
c'=4:if $i="h"}r:if $i="H"}r:c'=8:if $i="a"}r:if $i="A"}r:c'=16
if $i="b"}r:if $i="B"}r:c'=0
dsp of4" ERROR: MUST pick (A,B,x,y,h)! ":beep:wait2
dsp os34o:ret
#267:if c'<>1}268:x=i':ret
#268:if c'<>2}269:y=i':ret
#269:if c'<>4}270:h=i':ret
#270:if c'<>8}271:a=i':b=90-a:ret
#271:b=i':a=90-b:ret
#299:beep:wait4:go510
#298
wind bb1bf14b11f0wr9wc78r1c0" Oblique Triangle Program:
A
Pick three knowns and /\ A, B, & C are angles in
give their values. / \ degrees.
y / \ z At least one side must
The program will give / \ be given.
you the unknowns. /____________\
B x C"n:RET
#300:cls:d'=0:gos40:GOS298:I''=2
#301:row10:$i="0"
dsp" Pick the first known: (A,B,C,x,y,z) ":$i=inp(1){400}:if $i="0"}q
call 320:if t'=0}301
t''=t':dsp n" What is its value? "
i'=inp{401}:if i'=0}q:if sgn i'=-1}335:call321
dsp n
#302:$i="0":dsp " Pick the second known: "
$i=inp(1){400}:if $i="0"}q:call 320:if t'=0}302:t''=t''+t'
dsp n" What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}335
call321:dsp n
#303:$i="0":dsp " Pick the third known: "
$i=inp(1){400}:if $i="0"}q:call 320:if t'=0}303:t''=t''+t'
dsp n" What is its value? ":i'=inp{401}:if i'=0}q:if sgn i'=-1}335
call321
if t''=56}333:if t''<>7}340
if x<z}305:if x<y}305:if y+z<=x}334
A=acs((y^2+z^2-x^2)/(2*y*z)):b=asn((z*sin a)/x):c=180-a-b:goto319
#305
if y<z}306:if x+z<=y}334
c=acs((x^2+z^2-y^2)/(2*x*z)):a=asn((x*sin c)/y):b=180-c-a:goto319
#306
if x+y<z}334
b=acs((x^2+y^2-z^2)/(2*x*y)):c=asn((y*sin b)/z):a=180-b-c:goto319
#318
dsp s40ns40n" A ="(a)s5" x ="(x)n" B ="(b)s5" y ="(y)n" C ="(C)s5" z ="(Z)n
dsp s40n:ret
#319:call318:GOTO32
#320:t'=1:if $i="x"}r:if $i="X"}r:t'=2:if $i="y"}r:if $i="Y"}r
t'=4:if $i="z"}r:if $i="Z"}r:t'=8:if $i="a"}r:if $i="A"}r:t'=16
if $i="b"}r:if $i="B"}r:t'=32:if $i="c"}r:if $i="C"}r:t'=0
dsp of4" ERROR: MUST pick (A,B,C,x,y,z)! "o:beep
wait2
dsp os40o
ret
#321:if t'<>1}322:x=i':ret
#322:if t'<>2}323:y=i':ret
#323:if t'<>4}324:z=i':ret
#324:if t'<>8}325:a=i':ret
#325:if t'<>16}326:b=i':ret
#326:c=i':ret
#330
dsp n" ERROR: AN ANGLE CANNOT BE EQUAL TO OR GREATER THAN 180°!":GOTO299
#331:dsp n" ERROR: A KNOWN WAS USED TWICE!":goto299
#333:dsp n" ERROR: AT LEAST ONE SIDE MUST BE GIVEN!":GOTO299
#334:dsp n" ERROR: TRIANGLE IS NOT POSSIBLE WITH DATA GIVEN!":GOTO299
#335:dsp n" ERROR: A KNOWN CANNOT BE NEGATIVE!":goto299
#340:if t''>14}350:if a=>180}330
t'=t''
#341
call342:if e'=2}331:if e'=1}334:call348:goto32
#342
if t'=11}345:if t'=13}347:e'=2:if t'<>14}r:e'=0:if y>z}344
#343
x=sqr(z*z+y*y-2*z*y*cos a):b=acs((x*x+y*y-z*z)/(2*x*y)):c=180-a-b:ret
#344
y'=y:y=z:z=y':call343:y'=y:y=z:z=y':y'=b:b=c:c=y':ret
#345
if x<y}346
c=asn(y*sin a/x):b=180-a-c:z=(x*sin b)/sin a:ret
#346
e'=1:if asn(x/y)<a}r:e'=0
c=asn((y*sin a)/x):b=180-a-c:z=(y*sin b)/sin c
x''=x:y''=y:a''=a:c''=c:ROW10:COL0:call348:dsp " or"
x=x'':y=y'':a=a'':c=c''
c=180-c:b=180-c-a:z=(y*sin b)/sin c:ret
#347
y=z:d'=d'+3:call345:ret
#348
x'=data d'{x,y,z,x,z,y}
y'=data d'{y,z,x,z,y,x}
z'=data d'{z,x,y,y,x,z}
a'=data d'{a,c,b,a,b,c}
b'=data d'{b,a,c,c,a,b}
c'=data d'{c,b,a,b,c,a}
x=x':y=y':z=z':a=a':b=b':c=c'
goto318
#350
if t''>22}355:if b=>180}330
d'=1:t'=t''-19:t'=data t'{14,,11,13}:a=b:b=x:x=z:z=y:y=b:goto 341
#355
if t''>38}361:if t''<35}360:if c=>180}330
d'=2:t'=t''-35:t'=data t'{13,,14,11}:a=c:c=x:x=y:y=z:z=c:goto 341
#360
if a+b=>180}334:c=180-a-b:t'=t''-25:goto365
#361
if t''>44}362:if a+c=>180}334:b=180-a-c:t'=t''-41:goto365
#362
if b+c=>180}334:a=180-b-c:t'=t''-49
#365
if t'<>0}366:y=(x*sin c)/sin a:z=(x*sin b)/sin a:goto319
#366
if t'<>1}367:z=(y*sin b)/sin c:x=(y*sin a)/sin c:goto319
#367
if t'<>3}331:x=(z*sin a)/sin b:y=(z*sin c)/sin b:goto319
#400
wind ;
Type in the character for one
of the sides or angles of the
triangle that you know the
value of. Hit the enter key.
You will be asked for that
value next.
Hit any key to continue!;x:wait50:woff
ON(I'')C{248,298}:quit
#401
wind ;
Enter the value of the side
or angle you selected on the
previous line. You may enter
a number, a variable or a math
expression. Hit the enter key
when done.
Hit any key to continue!;x:wait50:woff
ON(I'')C{248,298}:quit
#500
cls:gmod0:graf:gos505:if x'''=0}501:fc6
dsp r0c0" Right Triangle Program:
A
Pick the two knowns A & B are angles in
and give their values. degrees.
y h At least one side must
The program will give you be given.
the unknowns.
90 x B"n
line x(38.5*x''')y(2*y''')ex(38.5*x''')ey(8*y''')w2
line ex(49.5*x''')
line y(8*y''')w1:i''=1:go251
#501
goff:go250
#502
goff:go300
#505
g'=vidm:x'''=0:if g'>19}r
x'''=data g'{0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,8,8,8,8,0}
y'''=data g'{0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,14,14,16,16,0}:ret
#510
cls:gmod0:graf:gos505:if x'''=0}502:fc6
dsp r0c0" Oblique Triangle Program:
A
Pick three knowns and A, B, & C are angles in
give their values. degrees.
y z At least one side must
The program will give be given.
you the unknowns.
B x C"n
line x(38.5*x''')y(2*y''')ex(30*x''')ey(7*y''')w2
line ex(44*x''')
line x(30*x''')y(7*y''')w1:i''=2:go301